﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Web.Master" AutoEventWireup="true" CodeBehind="GestionHorarios.aspx.cs" Inherits="SalaDeEnsayo.WebApplication.GestionHorarios" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<%@ MasterType VirtualPath="~/Web.Master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderMaster" runat="server">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:Panel ID="pnlHorarios" runat="server" GroupingText="Gestion de Horarios">
                <div>
                    <table style="width:800px;height:550px;">
                        <tr>
                            <td style="width:350px; height:275px;" valign="top">
                                <div style="height:25px;">
                                    <label for="Calendar">Calendario</label>
                                </div>
                                <asp:Calendar ID="CalendarManager" runat="server" BackColor="White" 
                                    BorderColor="Black" BorderStyle="Solid" CellSpacing="1" Font-Names="Verdana" 
                                    Font-Size="9pt" ForeColor="Black" Height="250px" NextPrevFormat="ShortMonth" 
                                    Width="380px" onselectionchanged="CalendarManager_SelectionChanged">
                                    <SelectedDayStyle BackColor="#333399" ForeColor="White" />
                                    <TodayDayStyle BackColor="#999999" ForeColor="White" />
                                    <OtherMonthDayStyle ForeColor="#999999" />
                                    <DayStyle BackColor="#CCCCCC" />
                                    <NextPrevStyle Font-Bold="True" Font-Size="8pt" ForeColor="#000" />
                                    <DayHeaderStyle Font-Bold="True" Font-Size="8pt" ForeColor="#333333" 
                                        Height="8pt" />
                                    <TitleStyle BackColor="White" Font-Bold="True" 
                                        Font-Size="12pt" ForeColor="Black" Height="12pt" />
                                </asp:Calendar>
                            </td>
                            <td style="width:450px;" valign="top" rowspan="2">
                                <div style="height:25px;">
                                    <div style="float:left; width:300px;"><asp:Label ID="lblFecha" runat="server" Text="[Label]"></asp:Label></div>
                                    <div style="float:left;">
                                        <label for="Sala">Sala</label>
                                        <asp:DropDownList ID="ddlSalas" runat="server" DataTextField="Nombre" AutoPostBack="true"
                                            DataValueField="Id" onselectedindexchanged="ddlSalas_SelectedIndexChanged">
                                        </asp:DropDownList>
                                    </div>
                                </div>
                                <asp:GridView ID="grdSchedule" runat="server" AutoGenerateColumns="false"
                                CssClass="mGrid" PagerStyle-CssClass="pgr"
                                DataKeyNames="Hora" AllowPaging="true" PageSize="12" 
                                PagerSettings-Mode="NumericFirstLast" HeaderStyle-ForeColor="White"
                                onpageindexchanging="grdSchedule_PageIndexChanging">
                                <RowStyle Height="41"/>
                                <Columns>
                                    <asp:BoundField HeaderText="Hora" DataField="Hora" ItemStyle-HorizontalAlign="Center" HeaderStyle-Font-Size="12px" ItemStyle-Font-Bold="true" ItemStyle-CssClass="tablagestionhorarios" HeaderStyle-Width="40px" />
                                    <asp:BoundField HeaderText="Grupo" DataField="Grupo" ItemStyle-HorizontalAlign="Left" ItemStyle-CssClass="tablagestionhorarios" HeaderStyle-Font-Size="12px" HeaderStyle-Width="295px" />
                                    <asp:TemplateField HeaderStyle-Width="15px" HeaderStyle-ForeColor="#666666" HeaderStyle-HorizontalAlign="Center">
                                        <ItemTemplate>
                                            <asp:ImageButton ID="btnAgregar" runat="server" CausesValidation="false" CommandArgument='<%# Eval("Hora") %>' Width="20" Height="20"
                                                ImageUrl="~/Images/date_add.png" Visible='<%# Eval("NoExiste") %>' OnClick="btnAgregar_OnClick" ToolTip="Reservar"/>
                                            <asp:ImageButton ID="btnModificar" runat="server" CausesValidation="false" CommandArgument='<%# Eval("Hora") %>' Width="20" Height="20"
                                                ImageUrl="~/Images/date_edit.png"  Visible='<%# Eval("Existe") %>' OnClick="btnModificar_OnClick" ToolTip="Reprogramar Reserva"/>

                                         </ItemTemplate>
                                    </asp:TemplateField>
                                    
                                    <asp:TemplateField HeaderStyle-Width="15px" HeaderStyle-ForeColor="#666666" HeaderStyle-HorizontalAlign="Center">
                                        <ItemTemplate>
                                           
                                            <asp:ImageButton ID="btnBorrar" runat="server" CausesValidation="false" CommandArgument='<%# Eval("Hora") %>' Width="20" Height="20"
                                                ImageUrl="~/Images/date_deny.png"  Visible='<%# Eval("Existe") %>' OnClick="btnBorrar_OnClick" ToolTip="Anular Reserva"/>

                                         </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                                </asp:GridView>
                            </td>
                        </tr>
                        <tr>
                            <td style="height:275px;">
                                <asp:Panel ID="pnlReserva" runat="server" GroupingText="" HorizontalAlign="Left">
                                    <table class="detalle">
                                        <tr>
                                            <td style="width:100px;">
                                                <label for="Grupo">Grupo:</label>
                                            </td>
                                            <td style="width:210px">
                                                <asp:DropDownList ID="ddlGrupo" runat="server" DataValueField="Id" DataTextField="Nombre_grupo"
                                                 Width="210">
                                                </asp:DropDownList>
                                           </td>
                                           <td>
                                                <asp:CustomValidator ID="validatorGrupo" runat="server" ErrorMessage="*"
                                                 ControlToValidate="ddlGrupo" ClientValidationFunction="ValidaDDL">
                                                </asp:CustomValidator>
                                           </td>
                                        </tr>
                                        <tr>
                                           <td>
                                                 <label for="Sala">Sala:</label>
                                           </td>
                                           <td>
                                                 <asp:DropDownList ID="ddlSala" runat="server" DataValueField="Id" DataTextField="Nombre"
                                                  Width="210">
                                                </asp:DropDownList>
                                            </td>
                                            <td>
                                                <asp:CustomValidator ID="validatorSala" runat="server" ErrorMessage="*"
                                                    ControlToValidate="ddlSala" ClientValidationFunction="ValidaDDL">
                                                </asp:CustomValidator>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <label for="horario_entrada">Horario Entrada:</label>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtHoraEntrada" runat="server" Width="210" ></asp:TextBox> 
                                            </td>
                                            
                                            <td>&nbsp;</td>
                                        </tr>
                                        
                                        <tr>
                                            <td>
                                                <label for="horario_salida">Horario Salida:</label>
                                            </td>
                                            <td>
                                               
                                                <asp:DropDownList ID="ddlHoraSalida" runat="server" Width="208px" onselectedindexchanged="ddlHorarioSalida_SelectedIndexChanged" AutoPostBack="True">
                                                </asp:DropDownList>
                                               
                                            </td>
                                           <td>
                                                <asp:CustomValidator ID="SalidaValidator" runat="server" ErrorMessage="*"
                                                 ControlToValidate="ddlHoraSalida" ClientValidationFunction="ValidaDDL">
                                                </asp:CustomValidator>
                                           </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <label for="Senia">Se&ntilde;a:</label>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtSenia" runat="server"></asp:TextBox> 
                                                <cc1:MaskedEditExtender ID="maskEditSenia" runat="server" TargetControlID="txtSenia"
                                                 MaskType="Number" Mask="999.99" PromptCharacter=" " InputDirection="RightToLeft">
                                                </cc1:MaskedEditExtender>
                                                <cc1:MaskedEditValidator ID="MaskedEditValidator2"  
                                                runat="server" 
                                                ControlToValidate="txtSenia"  
                                                ControlExtender="maskEditSenia"  
                                                IsValidEmpty="false"  
                                                EmptyValueMessage="*"  
                                                InvalidValueMessage="*">
                                                </cc1:MaskedEditValidator>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <label for="Saldo">Saldo:</label>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtSaldo" runat="server"></asp:TextBox> 
                                                <cc1:MaskedEditExtender ID="mskSaldo" runat="server" TargetControlID="txtSaldo"
                                                 MaskType="Number" Mask="999.99" PromptCharacter=" ">
                                                </cc1:MaskedEditExtender>
                                                <cc1:MaskedEditValidator ID="MaskedEditValidator9"  
                                                runat="server" 
                                                ControlToValidate="txtSenia"  
                                                ControlExtender="mskSaldo"  
                                                IsValidEmpty="false"  
                                                EmptyValueMessage="*"  
                                                InvalidValueMessage="*">
                                                </cc1:MaskedEditValidator>
                                            </td>
                                            <td>&nbsp;</td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <label for="estado">Estado:</label>
                                            </td>
                                            <td>
                                                <asp:DropDownList ID="ddlEstado" runat="server" Width="210">
                                                </asp:DropDownList>
                                            </td>
                                            <td>
                                                <asp:CustomValidator ID="EstadoValidator" runat="server" ErrorMessage="*"
                                                 ControlToValidate="ddlEstado" ClientValidationFunction="ValidaDDL">
                                                </asp:CustomValidator>
                                           </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <asp:Label ID="lblErrorHora" runat="server" Text="Horario en uso" ForeColor="Red" Visible="False"></asp:Label>
                                            </td>
                                            <td colspan="2" style="text-align:right;">
                                                <asp:ImageButton ID="btnGuardar" runat="server" OnClick="btnGuardar_Click" 
                                                    ImageUrl="~/Images/date_save.png" Height="30" Width="30" ToolTip="Guardar"/>
                                               
                                                <%--<asp:Button ID="btnCancelar" OnClick="btnCancelar_Click" CausesValidation="false" runat="server" Text="Cancelar" />    --%>
                                                                                                   
                                                 
                                                <asp:ImageButton ID="btnEliminar" runat="server" OnClick="btnEliminar_Click" 
                                                    ImageUrl="~/Images/date_deny.png" Height="30" Width="30" ToolTip="Eliminar"/>
                                                    
                                                <asp:ImageButton ID="btnCancelar" runat="server" OnClick="btnCancelar_Click" 
                                                ImageUrl="~/Images/prod_delete.jpg" Height="30" Width="30" ToolTip="Cancelar"/>
                                            </td>
                                        </tr>
                                    </table>
                                </asp:Panel>
                            </td>
                        </tr>
                    </table>
                </div>
            </asp:Panel>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
